import request from '@/utils/request'
import { encryptedData } from '@/utils/encrypt'
import { loginRSA } from '@/config'

export async function login(params) {
  // if (loginRSA) {
  //   data = await encryptedData(data)
  // }
  return request({
    url: '/Login/UserId=' + params.UserId,
    method: 'get',
    params,
  })
}

export async function socialLogin(data) {
  if (loginRSA) {
    data = await encryptedData(data)
  }
  return request({
    url: '/socialLogin',
    method: 'post',
    data,
  })
}
export function getUserInfo(params) {
  return request({
    url: `/getUserInfo`,
    method: 'get',
    params,
  })
}

export function getUserInfo1(params) {
  return request({
    url: `/UserManager/UserInfo/Index=${params.Index}&Count=${params.Count}&MatchString=${params.MatchString}`,
    method: 'get',
    params,
  })
}

export function logout() {
  return request({
    url: '/logout',
    method: 'get',
  })
}

export function register(data) {
  return request({
    url: '/register',
    method: 'post',
    data,
  })
}

export function UserInfo(params) {
  return request({
    url: `/UserManager/UserInfo/Index=${params.Index}&Count=${params.Count}&MatchString=${params.MatchString}`,
    method: 'get',
    params,
  })
}

export function UserInfos(data) {
  return request({
    url: '/UserManager/UserInfo/Renew/',
    method: 'post',
    data,
  })
}
